var express = require('express');
var router = express.Router();
const mongoose = require("mongoose")
/* GET home page. */
// 获取
router.get('/get_userlist',async function (req, res, next) {
    const data = await mongoose.model("storeAdminsModel").find({ status: "申请通过" })
    res.send(data)
});

// 获取管理员信息
router.get('/get_administratorList',async function (req, res, next) {


    // const data = await mongoose.model("storeAdminsModel").find()
    const data = await mongoose.model("platformAdminsModel").find({ status: "申请通过" })
    res.send(data)
});
// 删除管理员信息
router.post('/delete_administratorList',async function (req, res, next) {

console.log(req.body,787878787);

    const data = await mongoose.model("platformAdminsModel").deleteOne(req.body)
    res.send(data)
});

//删除
router.post('/remove_userlist',async function (req, res, next) {
    const data = await mongoose.model("storeAdminsModel").deleteMany(req.body)
    res.send(data)
});
// 修改
router.post('/update_userlist',async function (req, res, next) {
  
    const { _id, name, age, gender, position } = req.body
    const data = await mongoose.model("storeAdminsModel").updateOne({_id}, {name,age,gender,position})
    res.send(data)
});



module.exports = router;